package com.example.demo.dto;

import java.time.LocalDateTime;

public class TaskApprovalNodeDetailDTO {
    // TaskApprovalStatus 基本信息
    private Long id;                    // 审批状态记录ID
    private Long taskFlowId;            // 任务流程关系ID
    private Long taskId;                // 任务ID
    private Long dataSourceId;          // 数据源ID
    
    // 审批状态相关
    private Integer status;             // 状态：0=待处理,1=处理中,2=已通过,3=已拒绝,4=已跳过
    private String statusText;          // 状态文本描述
    private String comment;             // 审批意见
    private LocalDateTime startTime;    // 节点开始时间
    private LocalDateTime endTime;      // 节点完成时间
    private LocalDateTime createdAt;    // 创建时间
    private LocalDateTime updatedAt;    // 更新时间
    
    // 节点信息 (从 ProcessNode 获取)
    private Long nodeId;                // 节点ID
    private String nodeName;            // 节点名称
    private Integer nodeOrder;          // 节点顺序
    private String department;          // 部门
    private String role;                // 角色
    private String nodeContent;         // 节点内容（表单配置等）
    private Long departmentId;          // 部门ID
    private Long roleId;                // 角色ID
    
    // 审批人信息 (从 User 获取)
    private Long approverId;            // 审批人ID
    private String approverName;        // 审批人姓名
    private String approverAuthId;      // 审批人认证ID
    private String approverEmail;       // 审批人邮箱
    
    // 流程信息 (从 ProcessConfig 获取)
    private Long flowId;                // 流程ID
    private String flowName;            // 流程名称
    private String flowDescription;     // 流程描述
    private Integer flowStatus;         // 流程状态
    private Integer flowVersion;        // 流程版本

    public Long getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(Long departmentId) {
        this.departmentId = departmentId;
    }

    public String getNodeContent() {
        return nodeContent;
    }

    public void setNodeContent(String nodeContent) {
        this.nodeContent = nodeContent;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public Integer getNodeOrder() {
        return nodeOrder;
    }

    public void setNodeOrder(Integer nodeOrder) {
        this.nodeOrder = nodeOrder;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public Long getNodeId() {
        return nodeId;
    }

    public void setNodeId(Long nodeId) {
        this.nodeId = nodeId;
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getStatusText() {
        return statusText;
    }

    public void setStatusText(String statusText) {
        this.statusText = statusText;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Long getApproverId() {
        return approverId;
    }

    public void setApproverId(Long approverId) {
        this.approverId = approverId;
    }

    public String getApproverName() {
        return approverName;
    }

    public void setApproverName(String approverName) {
        this.approverName = approverName;
    }

    public String getApproverAuthId() {
        return approverAuthId;
    }

    public void setApproverAuthId(String approverAuthId) {
        this.approverAuthId = approverAuthId;
    }

    public String getApproverEmail() {
        return approverEmail;
    }

    public void setApproverEmail(String approverEmail) {
        this.approverEmail = approverEmail;
    }

    public Long getFlowId() {
        return flowId;
    }

    public void setFlowId(Long flowId) {
        this.flowId = flowId;
    }

    public String getFlowName() {
        return flowName;
    }

    public void setFlowName(String flowName) {
        this.flowName = flowName;
    }

    public String getFlowDescription() {
        return flowDescription;
    }

    public void setFlowDescription(String flowDescription) {
        this.flowDescription = flowDescription;
    }

    public Integer getFlowStatus() {
        return flowStatus;
    }

    public void setFlowStatus(Integer flowStatus) {
        this.flowStatus = flowStatus;
    }

    public Integer getFlowVersion() {
        return flowVersion;
    }

    public void setFlowVersion(Integer flowVersion) {
        this.flowVersion = flowVersion;
    }

    public Integer getStatus() {
        return status;
    }

    public Long getDataSourceId() {
        return dataSourceId;
    }

    public void setDataSourceId(Long dataSourceId) {
        this.dataSourceId = dataSourceId;
    }

    public Long getTaskId() {
        return taskId;
    }

    public void setTaskId(Long taskId) {
        this.taskId = taskId;
    }

    public Long getTaskFlowId() {
        return taskFlowId;
    }

    public void setTaskFlowId(Long taskFlowId) {
        this.taskFlowId = taskFlowId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    // 状态文本映射
    public static String getStatusText(Integer status) {
        if (status == null) return "未知";
        switch (status) {
            case 0: return "待处理";
            case 1: return "处理中";
            case 2: return "已通过";
            case 3: return "已拒绝";
            case 4: return "已跳过";
            default: return "未知";
        }
    }
    
    // 设置状态并自动更新状态文本
    public void setStatus(Integer status) {
        this.status = status;
        this.statusText = getStatusText(status);
    }
}